$(function(){
	var url = common.url();
	var began = 0;
	var listlen = 10;
	
	//关于点击后的连接问题，以及内容
	var arr = common.search();
	var newsarr = common.baseval('transform');
	var arrid = 1;
	if(arr.id && arr.id <= newsarr.length){
		arrid = arr.id;
	};
	var jk = common.Interface('transform')[arrid-1];
	common.hash('page',fnhash);
	$('.header-list li:last a').html(newsarr[arrid-1]);
	$('.contl-nav li').eq(arrid-1).addClass('hovs').siblings().removeClass('hovs');
	$('.cn-title').html(newsarr[arrid-1]);
	function fnhash(hash){
		//分页
		if(common.hashlist().page){
			began = (common.hashlist().page-1)*listlen
		}
		var url = jk +'&offset='+ began +'&limit='+ listlen
		$.ajax({
				url : url,
				type: "POST",
				error: function(request) {
					console.log(request)
				},
				dataType:"json",
				success: function(data) {
					if(data.ret){
						var json = data.data;
						var pages =Math.ceil(json.total / listlen);
						common.pagesgn(pages,6);
						$('.xn-list').html('')
						if(json.rows.length>0){
							for(var i=0;i<json.rows.length;i++){
								var title = common.maxlen(json.rows[i].title,40,true);
								var summary = common.maxlen(json.rows[i].summary,110,true);
								var times = common.timechange(json.rows[i].pubdate,true);
								var html = '<li><a href="/detail.htm?id='+ json.rows[i].id +'" class="trf-title">'+ title +'</a>\
								<p class="trf-val">'+ summary +'</p>\
								<div class="trf-seetime clear">\
									<p class="trf-time fl">'+ times +'</p>\
									<p class="trf-see fl">'+ json.rows[i].readCount +'</p></div></li>';
								$('.xn-list').append(html)
							}
						}else{
							$('.pages').css({'display':'none'})
						}
					}
					
					
				}
			})
	}
})
